######################################
# Media Measurement Matters          #
# Replication Code                   #
# Appendix M: Alternative Binning    #
######################################

# The following file contains code for replicating the figures and analyses in
# Appendix M. This appendix re-estimates the persuasion results using alternative
# binning strategies. For instance, rather than benchmark individuals' relative slant
# scores against exemplar cites (CNN and Yahoo!), we instead bin respondents into evenly
# sized groups. 

# Set-Up ----

# If desired, set up path into which to save plots and tables
plot_path <- NULL
table_path <- NULL

# Load packages
library(tidyverse)
library(ggridges)
library(ggalluvial)
library(ggpubr)
library(estimatr)
library(overlap)
library(gtools)
library(stargazer)

# Set up helper operations
`%notin%` <- Negate(`%in%`)

# Set up colors
red_mit = '#A31F34'
red_light = '#A9606C'
blue_mit = '#315485'
grey_light= '#C2C0BF'
grey_dark = '#8A8B8C'
black = '#353132'

# Source helper functions
source("helper_functions.R")

# > Read in data ----

# Read in survey data
srvy <- read_rds("data/survey_data_cleaned.rds")

# Categorize respondents into bins ----

# Categorize respondents into differently sized bins (3-6 groups per measure)
srvy <- srvy %>% 
  # Relative volume measures
  mutate(news_consump_bin4 = ntile(news_consump,4), # 4 bins 
         news_consump_bin5 = ntile(news_consump,5), # 5 bins 
         news_consump_bin6 = ntile(news_consump,6)) %>% # 6 bins
  # Relative slant measures (excluding portals)
  mutate(score_noportals_bin3 = ntile(score_noportals,3), # 3 bins (no portals)
         score_noportals_bin4 = ntile(score_noportals,4), # 4 bins (no portals)
         score_noportals_bin5 = ntile(score_noportals,5), # 5 bins (no portals)
         score_noportals_bin6 = ntile(score_noportals,6)) # 6 bins (no portals)

# > Construct labels for plotting ----

# Relative volume: 4-6 bins
consump_labels4 <- gen_ranges(bin_var = "news_consump_bin4", score_version = "news_consump",
                              parentheses = FALSE)
consump_labels5 <- gen_ranges(bin_var = "news_consump_bin5", score_version = "news_consump",
                              parentheses = FALSE)
consump_labels6 <- gen_ranges(bin_var = "news_consump_bin6", score_version = "news_consump",
                              parentheses = FALSE)

# Relative slant: 3 bins
med_labels3_noportals <- gen_ranges("score_noportals_bin3",
                                    score_version = "score_noportals", 
                                    parentheses = TRUE) # Forced choice group
med_labels3_noportals <- paste0(c("Most\nLiberal\n", "Moderate\n", "Most\nConservative\n"), 
                                med_labels3_noportals)

med_labels3_free <- gen_ranges("score_noportals_bin3", group = 0,
                                    score_version = "score_noportals", 
                                    parentheses = TRUE) # Forced choice group
med_labels3_free <- paste0(c("Most\nLiberal\n", "Moderate\n", "Most\nConservative\n"), 
                           med_labels3_free)

# Relative slant: 4-6 bins
med_labels4_noportals <- gen_ranges("score_noportals_bin4",
                                    score_version = "score_noportals")
med_labels5_noportals <- gen_ranges("score_noportals_bin5",
                                    score_version = "score_noportals")
med_labels6_noportals <- gen_ranges("score_noportals_bin6",
                                    score_version = "score_noportals")

# Descriptive results ----

# Set theme for plotting
theme_set(theme_bw() + 
            theme(legend.position = "bottom",
                  plot.title = element_text(hjust = 0.5, face = "bold",size = 16),
                  plot.subtitle = element_text(hjust = 0.5, face = "italic", size = 12),
                  axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),
                                              face = "bold", size = 12, angle = 0, hjust = 0.5),
                  axis.title.y = element_text(margin = unit(c(0, 3, 0, 0), "mm"), 
                                              face = "bold", size = 12),
                  legend.title = element_text(face = "bold", hjust = 0.5, size = 12),
                  legend.text = element_text(hjust = 0.5, size = 10),
                  axis.text.y = element_text(size = 10, color = "black"),
                  axis.text.x = element_text(size = 10, color = "black"),
                  legend.box = "vertical",
                  legend.background = element_blank(),
                  legend.box.background = element_rect(colour = "black"),
                  text=element_text(colour=black, 
                                    size=15)))

# Compare the counts for the tercile-based measure to the original version
table(srvy$score_code, srvy$forcedchoice)
table(srvy$score_noportals_bin3, srvy$forcedchoice)

# Figure M1: replicate Figure 2 using terciles versus exemplar sites to bin
# respondents' revealed slant scores
srvy_alluvial_terc <- srvy %>%
  filter(forcedchoice == 0) %>%
  group_by(score_noportals_bin3, med_pref, med_choice) %>%
  summarise(Freq = n()) %>%
  mutate(score_noportals_bin3 = factor(score_noportals_bin3,levels = 1:3,
                             labels = med_labels3_free, ordered = T),
         med_pref = factor(med_pref,levels=c("MSNBC","Entertainment","Fox"),
                           labels=c("MSNBC","Entertainment","Fox News"),
                           ordered=T),
         med_choice = factor(med_choice,levels=c("MSNBC","Entertainment","Fox"),
                             labels=c("MSNBC","Entertainment","Fox News"),
                             ordered=T)) %>% 
  as.data.frame()

(m1 <- ggplot(na.omit(srvy_alluvial_terc), 
                              aes(y=Freq, axis1=score_noportals_bin3,
                                  axis2=med_pref,axis3=med_choice)) + 
    geom_alluvium(aes(fill=score_noportals_bin3),width=1/7) + 
    geom_stratum(width=1/7, fill="black", color=grey_dark) + 
    geom_text(stat="stratum",aes(label=after_stat(stratum)),angle=c(-90),color="white",
              size=3.25) + 
    scale_x_discrete("", 
                     limits=c("score_noportals_bin3","med_pref","med_choice"),
                     labels=c("Web-Tracking:\nRelative Slant of\nNews Consumption",
                              "Survey:\nStated Media\nPreference","Survey:\nRevealed\nMedia Choice"), 
                     expand=c(0.05,0.05)) + 
    scale_y_continuous(limits = c(0, 1685)) + 
    scale_fill_manual(values=c(blue_mit, grey_dark, red_mit)) +
    ylab("Frequency") +
    theme_minimal() +
    theme(legend.position = "none",
          panel.grid.minor = element_blank(),
          panel.grid.major.x = element_blank(),
          axis.title.y = element_text(size = 12, color = "black", 
                                      margin = unit(c(0, 3, 0, 0), "mm")),
          axis.text.x = element_text(size = 12, color = "black", face = "bold"))
)

ggsave(m1, path = plot_path, filename = "fig_m1.pdf",
       width=11, height=7, dpi = 600)

# Relative volume results ----

# > Continuous score ----

# Set reference category to entertainment for all models
srvy <- srvy %>% 
  mutate(article_forced = factor(article_forced, levels = c("Entertainment",
                                                            "Fox", "MSNBC")))

# Estimate OLS models interacting the treatment (media exposure) with a continuous
# measure of relative volume (higher scores = higher levels of news consumption)
consump_contintx <- lm(charter_index ~ article_forced * scale(news_consump), 
                       data = srvy %>% filter(forcedchoice == 1))
consump_contintx_beh <- lm(actions_index ~ article_forced * scale(news_consump), 
                           data = srvy %>% filter(forcedchoice == 1))

consump_out_cont <- list(consump_contintx, consump_contintx_beh)

# Table M1: output results in a formatted table
stargazer(consump_out_cont, se = starprep(consump_out_cont), p = starprep(consump_out_cont, stat = "p.value"),
          digits=2, no.space = TRUE, column.sep.width = "-10pt", header = FALSE,
          font.size = "footnotesize", style = "apsr",
          table.layout ="=dc-t-s=n", dep.var.labels = c("\\textbf{Attitudinal Index}", "\\textbf{Sharing Index}"),
          covariate.labels = c("Fox", "MSNBC", "News Consumption (Standardized)",
                               "Fox $\\times$ News Consumption", "MSNBC $\\times$ News Consumption"), 
          label = "consump_contintx", title = "Difference in Treatment Effects by Revealed Volume Preferences (Continuous Measure of News Consumption)", 
          notes.append = TRUE,
          notes = c("\\textit{Note}: The reference category is Entertainment for media exposure. The news", 
                    "consumption measure is standardized. Both dependent variables range from", 
                    "0 to 1. \\textit{p} values are based on robust standard errors (HC2 variant)."),
          df = F, omit.stat=c("f", "ser"), model.numbers = FALSE,
          out = paste0(table_path, "/tab_m1.tex"))

# > Binned plots ----

# Figure M2: Relative volume results using quartiles (4 bins)
consump_vsent_fx4 <- vsent_plot(var = "news_consump", nbins = 4, 
                                labels = consump_labels4, weights = FALSE)

(m2 <- ggplot(na.omit(consump_vsent_fx4 %>% filter(id != "Fox vs.\nMSNBC")), 
                                   aes(x=factor(val),
                                       col = factor(id, levels = c("Fox vs.\nEntertainment",
                                                                   "MSNBC vs.\nEntertainment")),
                                       shape = factor(id, levels = c("Fox vs.\nEntertainment",
                                                                     "MSNBC vs.\nEntertainment")))) +
    geom_hline(yintercept=0, col = "white") +
    geom_hline(yintercept=0, linetype="dashed", color = grey_dark) +
    geom_errorbar(aes(ymin=min_cilo90, ymax=max_cihi90),
                  width=0, lwd = 1, position = position_dodge(width = 0.5)) +
    geom_errorbar(aes(ymin=min_cilo, ymax=max_cihi),
                  width=0, position = position_dodge(width = 0.5)) +
    geom_point(aes(y=naive),
               position = position_dodge(width = 0.5),
               size = 2) +
    facet_wrap(~ outcome,nrow=1) +
    scale_x_discrete(labels = unique(consump_vsent_fx4$bin)) + 
    xlab("Relative Volume of News vs. Non-News (Quartiles)") +
    ylab("Average Treatment Effect of\nPartisan Media vs. Entertainment") +
    scale_y_continuous(breaks=seq(-0.2,0.2,0.1),
                       labels=plot_labels()$att,
                       limits = c(-0.235, 0.235),
                       sec.axis = dup_axis(name="",
                                           breaks=seq(-0.2,0.2,0.1),
                                           labels = plot_labels()$share)) +
    scale_colour_manual("Comparison",values=c(red_mit, blue_mit)) +
    scale_shape_manual("Comparison",values=c(16, 17, 15)) +
    theme(axis.text.x = element_text(size = 10, angle = 45, hjust = 1, color = "black")))

ggsave(m2, path = plot_path, filename = "fig_m2.pdf", 
       dpi = 600, width=9, height=5.25)

# Figure M3: Relative volume results using quintiles (5 bins)
consump_vsent_fx5 <- vsent_plot(var = "news_consump", nbins = 5, 
                                labels = consump_labels5, weights = FALSE)

(m3 <- ggplot(na.omit(consump_vsent_fx5 %>% filter(id != "Fox vs.\nMSNBC")), 
              aes(x=factor(val),
                  col = factor(id, levels = c("Fox vs.\nEntertainment",
                                              "MSNBC vs.\nEntertainment")),
                  shape = factor(id, levels = c("Fox vs.\nEntertainment",
                                                "MSNBC vs.\nEntertainment")))) +
    geom_hline(yintercept=0, col = "white") +
    geom_hline(yintercept=0, linetype="dashed", color = grey_dark) +
    geom_errorbar(aes(ymin=min_cilo90, ymax=max_cihi90),
                  width=0, lwd = 1, position = position_dodge(width = 0.5)) +
    geom_errorbar(aes(ymin=min_cilo, ymax=max_cihi),
                  width=0, position = position_dodge(width = 0.5)) +
    geom_point(aes(y=naive),
               position = position_dodge(width = 0.5),
               size = 2) +
    facet_wrap(~ outcome,nrow=1) +
    scale_x_discrete(labels = unique(consump_vsent_fx5$bin)) + 
    xlab("Relative Volume of News vs. Non-News (Quintiles)") +
    ylab("Average Treatment Effect of\nPartisan Media vs. Entertainment") +
    scale_y_continuous(breaks=seq(-0.2,0.2,0.1),
                       labels=plot_labels()$att,
                       limits = c(-0.235, 0.235),
                       sec.axis = dup_axis(name="",
                                           breaks=seq(-0.2,0.2,0.1),
                                           labels = plot_labels()$share)) +
    scale_colour_manual("Comparison",values=c(red_mit, blue_mit)) +
    scale_shape_manual("Comparison",values=c(16, 17, 15)) +
    theme(axis.text.x = element_text(size = 10, angle = 45, hjust = 1, color = "black")))

ggsave(m3, path = plot_path, filename = "fig_m3.pdf", 
       dpi = 600, width=9, height=5.25)

# Figure M4: Relative volume results using sextiles (6 bins)
consump_vsent_fx6 <- vsent_plot(var = "news_consump", nbins = 6, 
                                labels = consump_labels6, weights = FALSE)

(m4 <- ggplot(na.omit(consump_vsent_fx6 %>% filter(id != "Fox vs.\nMSNBC")), 
              aes(x=factor(val),
                  col = factor(id, levels = c("Fox vs.\nEntertainment",
                                              "MSNBC vs.\nEntertainment")),
                  shape = factor(id, levels = c("Fox vs.\nEntertainment",
                                                "MSNBC vs.\nEntertainment")))) +
    geom_hline(yintercept=0, col = "white") +
    geom_hline(yintercept=0, linetype="dashed", color = grey_dark) +
    geom_errorbar(aes(ymin=min_cilo90, ymax=max_cihi90),
                  width=0, lwd = 1, position = position_dodge(width = 0.5)) +
    geom_errorbar(aes(ymin=min_cilo, ymax=max_cihi),
                  width=0, position = position_dodge(width = 0.5)) +
    geom_point(aes(y=naive),
               position = position_dodge(width = 0.5),
               size = 2) +
    facet_wrap(~ outcome,nrow=1) +
    scale_x_discrete(labels = unique(consump_vsent_fx6$bin)) + 
    xlab("Relative Volume of News vs. Non-News (Sextiles)") +
    ylab("Average Treatment Effect of\nPartisan Media vs. Entertainment") +
    scale_y_continuous(breaks=seq(-0.2,0.2,0.1),
                       labels=plot_labels()$att,
                       limits = c(-0.235, 0.235),
                       sec.axis = dup_axis(name="",
                                           breaks=seq(-0.2,0.2,0.1),
                                           labels = plot_labels()$share)) +
    scale_colour_manual("Comparison",values=c(red_mit, blue_mit)) +
    scale_shape_manual("Comparison",values=c(16, 17, 15)) +
    theme(axis.text.x = element_text(size = 10, angle = 45, hjust = 1, color = "black")))

ggsave(m4, path = plot_path, filename = "fig_m4.pdf", 
       dpi = 600, width=9, height=5.25)

# Relative slant results ----

# > Continuous score ----

# Estimate OLS models interacting the treatment (media exposure) with a continuous
# measure of relative slant (higher scores = more conservative diets)
slant_contintx <- lm(charter_index ~ article_forced * scale(score_noportals), 
                       data = srvy %>% filter(forcedchoice == 1))
slant_contintx_beh <- lm(actions_index ~ article_forced * scale(score_noportals), 
                           data = srvy %>% filter(forcedchoice == 1))

slant_out_cont <- list(slant_contintx, slant_contintx_beh)

# Table M2: output results in a formatted table
stargazer(slant_out_cont, se = starprep(slant_out_cont), p = starprep(slant_out_cont, stat = "p.value"),
          digits=2, no.space = TRUE, column.sep.width = "-10pt", header = FALSE,
          font.size = "footnotesize", style = "apsr",
          table.layout ="=dc-t-s=n", dep.var.labels = c("\\textbf{Attitudinal Index}", "\\textbf{Sharing Index}"),
          covariate.labels = c("Fox", "MSNBC", "Ideological Alignment Score (Standardized)",
                               "Fox $\\times$ Ideological Alignment Score", "MSNBC $\\times$ Ideological Alignment Score"), 
          label = "score_contintx", title = "Difference in Treatment Effects by Revealed Slant Preferences (Continuous Measure of Ideological Alignment)", 
          notes.append = TRUE,
          notes = c("\\textit{Note}: The reference category is Entertainment. The measure of ideological alignment", 
                    "is standardized, and portals are excluded. Both dependent variables range from", 
                    "0 to 1. \\textit{p} values are based on robust standard errors (HC2 variant)."),
          df = F, omit.stat=c("f", "ser"), model.numbers = FALSE,
          out = paste0(table_path, "/tab_m2.tex"))

# > Binned plots ----

# Figure M5: Relative slant results using terciles (3 bins)
score_vsent_fx <- vsent_plot(var = "score_noportals", nbins = 3, 
                             labels = med_labels3_noportals, weights = FALSE)

(m5 <- ggplot(na.omit(score_vsent_fx %>% filter(id != "Fox vs.\nMSNBC")), 
              aes(x=factor(val),
                  col = factor(id, levels = c("Fox vs.\nEntertainment",
                                              "MSNBC vs.\nEntertainment",
                                              "Fox vs.\nMSNBC")),
                  shape = factor(id, levels = c("Fox vs.\nEntertainment",
                                                "MSNBC vs.\nEntertainment",
                                                "Fox vs.\nMSNBC")))) +
    geom_hline(yintercept=0, col = "white") +
    geom_hline(yintercept=0, linetype="dashed", col = grey_dark) +
    geom_errorbar(aes(ymin=min_cilo90, ymax=max_cihi90),
                  width=0, lwd = 1, position = position_dodge(width = 0.5)) +
    geom_errorbar(aes(ymin=min_cilo, ymax=max_cihi),
                  width=0, position = position_dodge(width = 0.5)) +
    geom_point(aes(y=naive),
               position = position_dodge(width = 0.5),
               size = 2) +
    facet_wrap(~ outcome,nrow=1) +
    scale_x_discrete(labels = unique(score_vsent_fx$bin)) + 
    xlab("Relative Slant of News Consumption (Terciles)") +
    ylab("Average Treatment Effect of\nPartisan Media vs. Entertainment") +
    scale_y_continuous(breaks=seq(-0.2,0.2,0.1),
                       labels=plot_labels()$att,
                       limits = c(-0.235, 0.235),
                       sec.axis = dup_axis(name="",
                                           breaks=seq(-0.2,0.2,0.1),
                                           labels = plot_labels()$share)) +
    scale_colour_manual("Comparison",values=c(red_mit, blue_mit)) +
    scale_shape_manual("Comparison",values=c(16, 17, 15)) +
    theme(axis.text.x = element_text(size = 10, angle = 0, hjust = 0.5, color = "black")))

ggsave(m5, path = plot_path, filename = "fig_m5.pdf", 
       dpi = 600, width=9, height=5.25)

# Figure M6: Relative slant results using quartiles (4 bins)
score_vsent_fx4 <- vsent_plot(var = "score_noportals", nbins = 4, 
                             labels = med_labels4_noportals, weights = FALSE)

(m6 <- ggplot(na.omit(score_vsent_fx4 %>% filter(id != "Fox vs.\nMSNBC")), 
              aes(x=factor(val),
                  col = factor(id, levels = c("Fox vs.\nEntertainment",
                                              "MSNBC vs.\nEntertainment",
                                              "Fox vs.\nMSNBC")),
                  shape = factor(id, levels = c("Fox vs.\nEntertainment",
                                                "MSNBC vs.\nEntertainment",
                                                "Fox vs.\nMSNBC")))) +
    geom_hline(yintercept=0, col = "white") +
    geom_hline(yintercept=0, linetype="dashed", col = grey_dark) +
    geom_errorbar(aes(ymin=min_cilo90, ymax=max_cihi90),
                  width=0, lwd = 1, position = position_dodge(width = 0.5)) +
    geom_errorbar(aes(ymin=min_cilo, ymax=max_cihi),
                  width=0, position = position_dodge(width = 0.5)) +
    geom_point(aes(y=naive),
               position = position_dodge(width = 0.5),
               size = 2) +
    facet_wrap(~ outcome,nrow=1) +
    scale_x_discrete(labels = unique(score_vsent_fx4$bin)) + 
    xlab("Relative Slant of News Consumption (Quartiles)") +
    ylab("Average Treatment Effect of\nPartisan Media vs. Entertainment") +
    scale_y_continuous(breaks=seq(-0.2,0.2,0.1),
                       labels=plot_labels()$att,
                       limits = c(-0.235, 0.235),
                       sec.axis = dup_axis(name="",
                                           breaks=seq(-0.2,0.2,0.1),
                                           labels = plot_labels()$share)) +
    scale_colour_manual("Comparison",values=c(red_mit, blue_mit)) +
    scale_shape_manual("Comparison",values=c(16, 17, 15)) +
    theme(axis.text.x = element_text(size = 10, angle = 45, hjust = 1, color = "black")))

ggsave(m6, path = plot_path, filename = "fig_m6.pdf", 
       dpi = 600, width=9, height=5.25)

# Figure M7: Relative slant results using quintiles (5 bins)
score_vsent_fx5 <- vsent_plot(var = "score_noportals", nbins = 5, 
                              labels = med_labels5_noportals, weights = FALSE)

(m7 <- ggplot(na.omit(score_vsent_fx5 %>% filter(id != "Fox vs.\nMSNBC")), 
              aes(x=factor(val),
                  col = factor(id, levels = c("Fox vs.\nEntertainment",
                                              "MSNBC vs.\nEntertainment",
                                              "Fox vs.\nMSNBC")),
                  shape = factor(id, levels = c("Fox vs.\nEntertainment",
                                                "MSNBC vs.\nEntertainment",
                                                "Fox vs.\nMSNBC")))) +
    geom_hline(yintercept=0, col = "white") +
    geom_hline(yintercept=0, linetype="dashed", col = grey_dark) +
    geom_errorbar(aes(ymin=min_cilo90, ymax=max_cihi90),
                  width=0, lwd = 1, position = position_dodge(width = 0.5)) +
    geom_errorbar(aes(ymin=min_cilo, ymax=max_cihi),
                  width=0, position = position_dodge(width = 0.5)) +
    geom_point(aes(y=naive),
               position = position_dodge(width = 0.5),
               size = 2) +
    facet_wrap(~ outcome,nrow=1) +
    scale_x_discrete(labels = unique(score_vsent_fx5$bin)) + 
    xlab("Relative Slant of News Consumption (Quintiles)") +
    ylab("Average Treatment Effect of\nPartisan Media vs. Entertainment") +
    scale_y_continuous(breaks=seq(-0.2,0.2,0.1),
                       labels=plot_labels()$att,
                       limits = c(-0.235, 0.235),
                       sec.axis = dup_axis(name="",
                                           breaks=seq(-0.2,0.2,0.1),
                                           labels = plot_labels()$share)) +
    scale_colour_manual("Comparison",values=c(red_mit, blue_mit)) +
    scale_shape_manual("Comparison",values=c(16, 17, 15)) +
    theme(axis.text.x = element_text(size = 10, angle = 45, hjust = 1, color = "black")))

ggsave(m7, path = plot_path, filename = "fig_m7.pdf", 
       dpi = 600, width=9, height=5.25)

# Figure M8: Relative slant results using sextiles (6 bins)
score_vsent_fx6 <- vsent_plot(var = "score_noportals", nbins = 6, 
                              labels = med_labels6_noportals, weights = FALSE)

(m8 <- ggplot(na.omit(score_vsent_fx6 %>% filter(id != "Fox vs.\nMSNBC")), 
              aes(x=factor(val),
                  col = factor(id, levels = c("Fox vs.\nEntertainment",
                                              "MSNBC vs.\nEntertainment",
                                              "Fox vs.\nMSNBC")),
                  shape = factor(id, levels = c("Fox vs.\nEntertainment",
                                                "MSNBC vs.\nEntertainment",
                                                "Fox vs.\nMSNBC")))) +
    geom_hline(yintercept=0, col = "white") +
    geom_hline(yintercept=0, linetype="dashed", col = grey_dark) +
    geom_errorbar(aes(ymin=min_cilo90, ymax=max_cihi90),
                  width=0, lwd = 1, position = position_dodge(width = 0.5)) +
    geom_errorbar(aes(ymin=min_cilo, ymax=max_cihi),
                  width=0, position = position_dodge(width = 0.5)) +
    geom_point(aes(y=naive),
               position = position_dodge(width = 0.5),
               size = 2) +
    facet_wrap(~ outcome,nrow=1) +
    scale_x_discrete(labels = unique(score_vsent_fx6$bin)) + 
    xlab("Relative Slant of News Consumption (Sextiles)") +
    ylab("Average Treatment Effect of\nPartisan Media vs. Entertainment") +
    scale_y_continuous(breaks=seq(-0.2,0.2,0.1),
                       labels=plot_labels()$att,
                       limits = c(-0.235, 0.235),
                       sec.axis = dup_axis(name="",
                                           breaks=seq(-0.2,0.2,0.1),
                                           labels = plot_labels()$share)) +
    scale_colour_manual("Comparison",values=c(red_mit, blue_mit)) +
    scale_shape_manual("Comparison",values=c(16, 17, 15)) +
    theme(axis.text.x = element_text(size = 10, angle = 45, hjust = 1, color = "black")))

ggsave(m8, path = plot_path, filename = "fig_m8.pdf", 
       dpi = 600, width=9, height=5.25)
